package com.csii.ams.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.csii.adhoc.info.user.UserPo;
import com.csii.ams.AmsLog;

import com.csii.ams.mapper.AmsLogMapper;
import com.csii.ams.service.AmsLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @description:
 * @author: panChuanJiang
 * @create: 2021-03-19 10:55
 */
@Service("amsLogService")
public class AmsLogServiceImpl implements AmsLogService {
    @Resource
    private AmsLogMapper amsLogMapper;

    @Override
    public void insertAmsLog(AmsLog amsLog) {
        amsLogMapper.insert(amsLog);
    }

    @Override
    public IPage<AmsLog> queryPageAmsLog(Page<AmsLog> page,AmsLog vo) {

        IPage<AmsLog> amsLogIPage = amsLogMapper.selectListAmsLog(vo, page);
        for (AmsLog amsLog:amsLogIPage.getRecords()) {
            amsLog.setOpDt(getNewData(amsLog.getOpDt())+getNewData2(amsLog.getOpTm()));
        }
        return amsLogIPage;
    }

    private String getNewData(String data){
       data =  data.substring(0,4)+"年"+data.substring(4,6)+"月"+data.substring(6,8)+"日";
        return data;
    }
    private String getNewData2(String data){
        data =  data.substring(0,2)+"时"+data.substring(2,4)+"分"+data.substring(4,6)+"秒";
        return data;
    }
}
